/**********************init***********************/
function queryAnnCollect_annCollect(page){
	sys_loading();
	var type = $('#ann_type').val();
	var parm = null
	if ('1' == type) {
		parm = $('#queryAnnCollectForm').serialize() + (page != null ? ('&page=' + page) : '');
	} else if ('2' == type) {
		parm = $('#queryCollectForm').serialize() + (page != null ? ('&page=' + page) : '');
	}
	sys_loading();
	var url = create_url('annCollect-query');
	sys_record_parm('annCollect',parm);
	$.ajax({type:'POST', url:url, data:parm,
		success: function(result) {
			sys_loading_close();
			if ('1' == type) {
				$('#annCollectResultList').html(result);
			} else if ('2' == type) {
				$('#collectResultList').html(result);
			}
		}
	});
}

function showAnn_annCollect(code) {
	var parm = {'code':code};
	var url = create_url("annCollect-edit");
	$.colorbox({overlayClose:false, href:url, data:parm, close:'[关闭]', width:'1000px', open:true});
}


function shieldAnnCollect_annCollect(code, title) {
	$.Zebra_Dialog('确定是否屏蔽'+title + ' 吗？',{
	'type': 'question',
	'title': '警告' ,
	'buttons':[
	           {caption:'屏蔽',callback:function() {
	        	   var url = create_url('annCollect-shield');
	        	   aidExecuteAnnCollect_annCollect(code, url);
	    		}},
	           {caption:'取消',callback:function(){}
	    	}]
	});
}

function unshieldAnnCollect_annCollect(code, title) {
	$.Zebra_Dialog('确定是否给'+title + '解除屏蔽吗？',{
	'type': 'question',
	'title': '警告' ,
	'buttons':[
	           {caption:'屏蔽',callback:function() {
	        	   var url = create_url('annCollect-unshield');
	        	   aidExecuteAnnCollect_annCollect(code, url);
	    		}},
	           {caption:'取消',callback:function(){}
	    	}]
	});
}

function collectAnnCollect_annCollect(code, title) {
	$.Zebra_Dialog('确定是否收藏'+title + ' 内容吗？',{
	'type': 'question',
	'title': '警告' ,
	'buttons':[
	           {caption:'确定',callback:function() {
	        	   var url = create_url('annCollect-collect');
	        	   aidExecuteAnnCollect_annCollect(code, url);
	    		}},
	           {caption:'取消',callback:function(){}
	    	}]
	});
}

function aidExecuteAnnCollect_annCollect(code, url) {
	var parm = {'code':code};
	sys_submiting();
	$.ajax({type:'POST', url:url, data:parm,
		success: function(result) {
			sys_submiting_close();
			if ('success' == result) {
				queryAnnCollect_annCollect();
			} else if ('deleted' == result){ 
				new $.Zebra_Dialog('你不能删除指派的任务', {
				    'buttons':  false,
				    'modal': false,
				    'auto_close': 2000
				});
			} else {
				new $.Zebra_Dialog('操作失败，请刷新页面再次尝试，如果问题依然存在，请联系管理员!', {
				    'buttons':  false,
				    'modal': false,
				    'auto_close': 2000
				});
			}
		}
	});
}
